package me.zk.practice1.s;

import java.util.LinkedList;
import java.util.Stack;

/**
 * @author zhangkai
 * @date 2023/7/13 14:28
 */
public class LS_Offer_09 {
    Stack<Integer> out =null;
    Stack<Integer> in = null;
    public LS_Offer_09() {
        out = new Stack<>();
        in = new Stack<>();
    }

    public void appendTail(int value) {
        in.push(value);
    }

    public int deleteHead() {
        if (out.isEmpty()) {
            if (in.isEmpty()) {
                return -1;
            }
            while (!in.isEmpty()) {
                out.push(in.pop());
            }

        }
        return out.pop();
    }
}
